<?php

/****************************************
  CONFIG FILE   [From here on, Editable]
*****************************************/

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

/*
 * 		Some basic configurations that assist Antares in running.
 */
$config['slash']            		=   "/";    //  Set to "/" for UNIX, and "\" for Windows
$config['defaultModule']    		=   'home'; //default module to run
$config['baseDir']          		=   dirname(__FILE__).$config['slash'];
$config['baseUrl']          		=   ereg_replace("index.php","",'http://'.$_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']);

/*
 * 		Use flags which determine which functionality to include
 * 		within the run-time of Antares.
 */
$config['usessl']           		=   FALSE;
$config['useauth']          		=   FALSE;
$config['usedb']            		=   TRUE;
$config['usejslib']         		=   FALSE;

/*
 * 		Configurations for Auth_DB authorization API.
 */
$config['auth']['engine']           =   "LDAP";
$config['auth']['db']               =   array(
                        'usersTable'    =>  '',
                        'idField'       =>  '',
                        'usernameField' =>  '',
                        'passwordField' =>  ''
                        );

/*
 * 		Configurations for Auth_LDAP authorization API.
 */
$config['auth']['ldap']             =   array(
                        'hostname'  	=>  'localhost',
                        'baseDN'    	=>  'dc=domain,dc=com'
                        );

/*
 * 		Configurations for Database connections.
 */
$config['db']['core']       		=   "PDO";

//local dev
$config['db']['dsn']        		=   array(
                        'engine'    	=>  'mysql',
                        'host'      	=>  '127.0.0.1',
                        'user'      	=>  'root',
                        'password'  	=>  'jacobs1',
                        'name'      	=>  'tasting',
						'master'		=>	TRUE
                        );

                        
/*
 * 		Configurations for the JSLib module.
 */
$config['jslib']['core']    		=   "extjs";
$config['jslib']['baseDir'] 		=   "_js/ext-2.0.2/";

//time settings
date_default_timezone_set("America/Chicago");

/***************************************
  NO MORE EDITING!!!!
***************************************/

define('slash', $config['slash']);
define('baseDir', $config['baseDir']);
define('core', baseDir .'core'. slash);
define('api', core .'api'. slash);
define('frwrk', core .'framework'. slash);
define('module', baseDir .'modules'. slash);
define('htmlDir', baseDir .'view'. slash);
define('jsBaseDir', baseDir .'_js'. slash);
define('cssLoadDir', $config['baseUrl'] .'_css'. slash);
define('jsLoadDir', $config['baseUrl'] .'_js'. slash);


function __autoload($class_name) {
  try {
    if(file_exists(api.$class_name.'.class.php')) {
      require_once(api.$class_name.'.class.php');
    } elseif(file_exists(frwrk.$class_name.'.class.php')) {
      require_once(frwrk.$class_name.'.class.php');
    } elseif($filepath = recursiveAutoload(module,$class_name)) {
      require_once($filepath);
    } else {
      throw new Exception('Error requiring class named: '.$class_name);
    }
  } catch(Exception $e) {
    echo $e->getMessage();
  }
}

function recursiveAutoload($path,$class_name) {
  foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path),2) as $file) {
    if($file->isFile() && $file->getFilename() == $class_name.'.class.php') return $file->getPathname();
  }
}

?>
